<template>
  <div id="z">
    <div class="bcc"></div>
    <div id="d1">
      <div class="own" v-if="!islogin">
        <router-link to="/login">
          <img class="touxiang" src="../assets/21.png" name="touxiang"
        />
        <span>个人昵称</span></router-link>
      </div>
      <div class="own" v-else> 
        <router-link to="/myinfo">           
          <img class="touxiang" :src="`http://localhost:3000/avatar/${img}`" name="touxiang"
        />

        <span>{{uname}}</span></router-link>
      </div>
      <div class="car">
        <div class="car-1">
          <h3>LV1</h3>
         <span>会员权益<router-link to="/rights">></router-link></span>
        </div>
        <div class="car-2">
          <div class="car-2-1">
            <p>0/100</p>
            <input type="text" />
            <p class="zhi">距离下一等级只差100成长值<a href="">></a></p>
          </div>
          <div class="car-2-2">
            <router-link to="/vip"><img src="../assets/erweima.jpg" name="erweima" />
            <p>会员码</p></router-link>
          </div>
        </div>
      </div>
    </div>
    <div id="d2" v-if="!islogin">
      <span>注册后积分变动时可第一时间得到通知</span>
      <button @click="go">去领取</button>
    </div>
    <div id="d21" v-else>    
    </div>
    <div id="d3">
      <h5>我的资产</h5>
      <div id="d3-1">
        <router-link to="/coupon"><div>
          <h3>2</h3>
          <p>奈雪券</p>
        </div></router-link>
        <router-link to="/integral"><div>
          <h3>0</h3>
          <p>积分商城</p>
        </div></router-link>
        <router-link to="/integral"><div>
          <h3>0.00</h3>
          <p>余额(元)</p>
        </div></router-link>
        <router-link to="/giftcard"><div>
          <h3>0</h3>
          <p>礼品卡</p>
        </div></router-link>
      </div>
    </div>
    <div id="d3">
      <h5>我的服务</h5>
      <van-grid>
        <van-grid-item><router-link to="/memberstore">
          <van-badge>
            <template #content> hot </template>
          </van-badge>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-chuzhi"></use>
          </svg>
          <p>储值有礼</p></router-link>
        </van-grid-item>
        <van-grid-item><router-link to="/sign">
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-icon"></use>
          </svg>
          <p>积分签到</p></router-link>
        </van-grid-item>
        <van-grid-item><router-link to="/giftcard">
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-keaide"></use>
          </svg>
          <p>送TA心意</p></router-link>
        </van-grid-item>
        <van-grid-item><router-link to="/customerservice">
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-huihuaguanli"></use>
          </svg>
          <p>联系客服</p></router-link>
        </van-grid-item>
       <van-grid-item><router-link to="/exchange">
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-jinbiduihuan"></use>
          </svg>
          <p>兑换中心</p></router-link>
        </van-grid-item>
       <van-grid-item><router-link to="/adress">
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-dizhiguanli"></use>
          </svg>
          <p>收货地址</p></router-link>
        </van-grid-item>
        <van-grid-item><router-link to="/vip">
          <van-badge>
            <template #content>new</template>
          </van-badge>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-qunzu"></use>
          </svg>
          <p>入群有礼</p></router-link>
        </van-grid-item>
        <van-grid-item><router-link to="/vip">
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-gengduo"></use>
          </svg>
          <p>更多服务</p></router-link>
        </van-grid-item>
      </van-grid>
    </div>
    <tabbar/>
  </div>
</template>

<script>
import { mapState,mapMutations } from "vuex";
import tabbar from '../components/Tabbar.vue';
export default {
  components: { tabbar },
  computed: {
    ...mapState(['uname','islogin','img']),
  },
  methods: {
    ...mapMutations(['updateUname','updateImg']),
    go(){
      this.$router.push("register");
    },
  
  },
};
</script>

<style scoped>
* {
  margin: 0;
  padding: 0;
}
#z {
  min-height: 100vh;
  background-color: rgb(243, 241, 241);
}
.bcc {
  width: 100%;
  height: 25vh;
  /* background-image: url(/image/bcc.png); */
  background-color: #a7d500;
}
#d1 {
  position: relative;
  border: 1px solid gainsboro;
  border-radius: 10px;
  top: -16vh;
  margin: 3vh 2vh 2vh;
  background-color: white;
  box-shadow: 2px 2px gainsboro;
}
#d1 .own .touxiang {
  width: 10vh;
  height: 10vh;
  border-radius: 50%;
  position: absolute;
  top: -7vh;
}
#d1 .own span {
  display: inline-block;
  color: black;
  margin: 4vh 0 2vh;
  font-size: 15px;
}
.car {
  height: 17vh;
  background-color: #f3fae7;
  padding: 1vh 2vh 0;
  margin: 0 2vh 1.5vh;
  border-radius: 20px;
}
.car-1 {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin: 1vh 2vh;
}
.car-1 span {
  font-size: 14px;
}
.car-2 {
  display: flex;
  justify-content: space-between;
  margin-top: 1vh;
  margin-top: 2vh;
}
.car-2 .car-2-1 p {
  display: flex;
  justify-content: start;
  font-size: 12px;
}
.car-2 .car-2-1 input {
  height: 1vh;
  border-radius: 30px;
  border: 0;
  margin: 0.5vh 0;
}
.car-2 .car-2-1 .zhi {
  font-size: 12px;
  margin-top: 1vh;
}
.car-2-2{
  width: 20%;
}
.car-2-2 img {
  width: 60%;
}
.car-2-2 p {
  margin-top: 1vh;
  font-size: 13px;
}
#d2 {
  width: 80%;
  background-color: #f3fae7;
  padding: 0.5vh;
  border-radius: 10px;
  margin-top: -17vh;
  margin-left: 5vh;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
#d21{
  margin-top: -17vh;
}
#d2 span {
  font-size: 12px;
}
#d2 button {
  border-radius: 20px;
  border: 0;
  font-size: 12px;
  padding: 0.5vh;
  background-color: #a7d500;
}
#d3 {
  border: 1px solid gainsboro;
  border-radius: 10px;
  box-shadow: 2px 2pxgainsboro;
  margin: 0.5vh 2vh;
  padding: 1vh 0;
  z-index: 20;
  background-color: white;
}
#d3 h5 {
  margin-left: -40vh;
  margin-bottom: 1vh;
  font-size: 14px;
  font-weight: bold;
}
#d3-1 {
  display: flex;
  justify-content: space-around;
}
#d3 p {
  font-size: 12px;
  margin-top: 1vh;
}
.icon {
  height: 4vh;
  width: 4vh;
}
::v-deep .van-badge {
  min-width: 4vh;
  margin-top: -2vh;
  margin-left: 6vh;
}
a{
  color: black;
}
</style>